<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<%@ include file="/WEB-INF/views/include/header.jsp"%>
<body class="gray-bg">
    <div class="container-div">
		<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
			<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="cms:site:add">
				<i class="fa fa-plus"></i> 添加
			</a>
			<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="cms:site:edit">
	            <i class="fa fa-edit"></i> 修改
	        </a>
			<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="cms:site:remove">
				<i class="fa fa-remove"></i> 删除
			</a>
		</div>
			
		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table" data-mobile-responsive="true"></table>
		</div>
    </div>
	<%@ include file="/WEB-INF/views/include/footer.jsp"%>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('cms:site:edit')}]];
        var removeFlag = [[${@permission.hasPermi('cms:site:remove')}]];
        var prefix = ctx + "cms/site";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                modalName: "站点管理",
                columns: [{
		            checkbox: true
		        },
				{
					field : 'siteId', 
					title : '站点编号' 
				},
				{
					field : 'siteName', 
					title : '站点名称' 
				},
				{
					field : 'sitePath', 
					title : '站点简称' 
				},
				{
					field : 'keywords', 
					title : '关键字' 
				},
				{
					field : 'domainName', 
					title : '域名' 
				},
				{
					field : 'accessProtocol', 
					title : '访问协议' 
				},
				{
					field : 'accessPath', 
					title : '访问地址' 
				},
				{
					field : 'templateName', 
					title : '模板名称' 
				},
				{
					field : 'templatePath', 
					title : '模板路径' 
				},
				{
					field : 'isMaster', 
					title : '是否主站:0、否1、是' 
				},
				{
					field : 'sort', 
					title : '排序' 
				},
				{
					field : 'status', 
					title : '0、删除 1、正常' 
				},
				{
					field : 'remark', 
					title : '备注' 
				},
				{
					field : 'createBy', 
					title : '创建者' 
				},
				{
					field : 'createTime', 
					title : '创建时间' 
				},
				{
					field : 'updateBy', 
					title : '更新者' 
				},
				{
					field : 'updateTime', 
					title : '更新时间' 
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.siteId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.siteId + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>